package com.dabaozhan.modules.wx_app.service.impl;

import com.dabaozhan.common.utils.Utils;
import com.dabaozhan.modules.wx_app.dao.BankcardInfoMapper;
import com.dabaozhan.modules.wx_app.entity.BankcardInfoEntity;
import com.dabaozhan.modules.wx_app.service.BankcardInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author houzhong
 * @date 2018-12-29 15:03
 */
@Service("bankcardInfoService")
public class BankcardInfoServiceImpl implements BankcardInfoService {


    @Autowired
    private BankcardInfoMapper bankcardInfoMapper;

    @Override
    public int saveSiteBankcardInfo(BankcardInfoEntity v) {
        if (v.getId() == null) {
            v.setId(Utils.id().toString());
        }
        return bankcardInfoMapper.save(v);
    }

    @Override
    public int updateSiteBankcardInfo(BankcardInfoEntity v) {

        return bankcardInfoMapper.update(v);
    }

    @Override
    public BankcardInfoEntity findByUserId(String userId) {

        return bankcardInfoMapper.getObjectById(userId);
    }
}
